<!--
  Author: 善良的YWJ
  Created by shanliangdeYWJ on 2020/09/30
  File: 06.3.3事件.html
  Description: "
  
   请输入文件描述内容
  
               " 
  Github: https://github.com/shanliangdeYWJ
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <meta name="keywords" content="">
  <meta name="description" content="">
  <title>06.3.3事件</title>
  <style></style>
</head>

<body>

  <div id="root"></div>

  <!-- 加载 React。-->
  <!-- 注意: 部署时，将 "development.js" 替换为 "production.min.js"。-->
  <!--<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
  <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>-->
  <script src="../js/react@16.development.js" crossorigin></script>
  <script src="../js/react-dom@16.development.js" crossorigin></script>
  <script src="../js/babel@6.min.js"></script>
  <!-- <script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script> -->

  <!-- 加载我们的 React 组件。-->
  <script type="text/babel">

    class Toggle extends React.Component {
      constructor(props) {
        super(props);
        this.state = { isToggleOn: true };
      }
      // 我们定义了一个简单的事件，绑定这个事件的对象会传递给他一个点击 e 事件参数
      // 并且他可以访问target属性
      handleClick(e) {
        console.log(e);
        // console.log( this.state); // 因为没有绑定到this上因此无法获取构造器上的属性
      }

      render() {
        const val = '1314'
        return (
          <button href="#" onClick={this.handleClick} value="121212">点击</button>
        )
      }
    }

    ReactDOM.render(
      <Toggle />,
      document.getElementById('root')
    )
  </script>
</body>

</html>